// pages/components/mytree/mytree.js
Component({
  properties: {
    model: Object,
  },
  data: {
    open: true,
    isBranch: false,
  },

  methods: {
    toggle: function (e) {
      if (this.data.isBranch) {
        this.setData({
          open: !this.data.open,
        })
      }
    },
    tapItem: function (e) {
       
      this.triggerEvent('onClick',this.data.model, { });
    },
    onClick:function (e){
       
      this.triggerEvent('onClick',e.detail, {});
    }
  },

  ready: function (e) {
    this.setData({
      isBranch: Boolean(this.data.model.children && this.data.model.children.length),
    });
    console.log(this.data);
  },
})